package com.ice.project.datamining.gui;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

public class CellRenderer extends DefaultTableCellRenderer {
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		//Cells are by default rendered as a JLabel.
	    JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    
	    if (row == column) {
	      l.setForeground(new Color(14,166,0));
	    } else {
	      l.setForeground(Color.RED);
	    }

		//Return the JLabel which renders the cell.
		return l;
	}
}
